package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.ProcessBlxx;
import com.indusfo.spc.service.ProcessBlxxService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ProjectName: IEIS2-COM
 * @Package: com.indusfo.spc.controller
 * @ClassName: ProcessBlxxController
 * @Author: 熊冰
 * @Description: 流程不良现象 接口
 * @Date: 2019/9/4 16:42
 * @Version: 1.0
 */
@Controller
@RequestMapping("/processBlxx")
public class ProcessBlxxController {
    @Autowired
    private ProcessBlxxService processBlxxService;

    /**
     * 修改不良对策
     *
     * @param processBlxx
     * @return
     */
    @RequestMapping(value = "/updateProcessBlxx",method= RequestMethod.POST)
    @SystemControllerLog(description="修改不良对策")
    @ResponseBody
    public JSONObject updateProcessBlxx (ProcessBlxx processBlxx){

        JSONObject json=processBlxxService.updateProcessBlxx(processBlxx);

        return json;
    }

    /**
     * 查询
     *
     * @param
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/queryProcessBlxx")
    @SystemControllerLog(description="查询不良对策")
    @ResponseBody
    public JSONObject queryDep(ProcessBlxx processBlxx) {

        JSONObject json = processBlxxService.queryProcessBlxx(processBlxx);
        return json;

    }

    /**
     * 插入
     *
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/insertProcessBlxx", method= RequestMethod.POST)
    @SystemControllerLog(description="新增不良对策")
    @ResponseBody
    public JSONObject insertProcessBlxx(ProcessBlxx processBlxx) {

        JSONObject json = processBlxxService.insertProcessBlxx(processBlxx);
        return json;
    }

    /**
     * 启用/停用
     *
     * @param processBlxxIds, dataState
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/definesProcessBlxx", method= RequestMethod.POST)
    @SystemControllerLog(description="启用/停用不良对策")
    @ResponseBody
    public JSONObject definesProcessBlxx(@RequestParam("processBlxxIds") List<Integer> processBlxxIds, Integer dataState) {

        JSONObject json = processBlxxService.deleteProcessBlxx(processBlxxIds, dataState);
        return json;
    }

    /**
     * 删除
     *
     * @param processBlxxIds, dataState
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/deleteProcessBlxx", method= RequestMethod.POST)
    @SystemControllerLog(description="删除不良对策")
    @ResponseBody
    public JSONObject delProcessBlxx(@RequestParam("processBlxxIds") List<Integer>  processBlxxIds, Integer dataState) {

        dataState = 2;
        JSONObject json = processBlxxService.deleteProcessBlxx(processBlxxIds, dataState);
        return json;
    }

    /**
     * 批量新增
     *
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/batchInsertProcessBlxx", method= RequestMethod.POST)
    @SystemControllerLog(description="新增不良对策")
    @ResponseBody
    public JSONObject batchInsertProcessBlxx(@RequestParam("blxxIds") List<Integer> blxxIds, Integer lProFlow) {

        JSONObject json = processBlxxService.batchInsertProcessBlxx(blxxIds,lProFlow);
        return json;
    }
}
